if in formulas
https://gyazo.com/f34157fc1cb1fb44299121220725502a
$ \sum_{x:0<x<N} f(x) = \sum_x f(x)[0<x<N]
Personally, I didn't like Kronecker's delta and indicator functions because they were hard to read, but I thought this notation was nice because it didn't make it too hard to read.
When neither True nor False has a non-zero value, it is easier to read if it is written in pieces rather than put together (B below).
A: $ (x < 0 ? -1 : 1)
B: $ -1[x<0] + 1[x\ge0]
C: $ 1 -2[x<0]
D: $ -1\delta_{x<0} + 1 \delta_{x\ge0}
E: $ 1 - 2\delta_{x<0}
$ [k \,\,\mathrm{even}] [k \,\,\mathrm{odd}] [k \,\,\mathrm{prime}] [k \,\,\mathrm{divedes} \,\,n]
https://gyazo.com/b0463982ecb09c045acdd774d66c27d5
https://gyazo.com/86ae63fcd61a851bd0318e7e2afc1615
---
This page is auto-translated from /nishio/数式でのif. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. I'm very happy to spread my thought to non-Japanese readers.